<!DOCTYPE html>
<html>
	<head>
		<meta charset="{CHARSET}">
		<title></title>
		<link href="bootstrap.min.css" rel="stylesheet">
	   <script src="jquery-3.3.1.min.js"></script>
	   <script src="bootstrap.min.js"></script>
	</head>
	<body>
	<div>
	<button type="button" onclick="myobj()" >解析</button>
	</div>
	<div id="result">结果</div>
	</body>
	<script>
	
			var obj={ "seed": "QQQ"  , 
			   "id" : 1 ,        
			   "n_validation": [2, 3, 4, 5, 6],     
			   "TEXT": [       
					 {            
							   "test": "A",             
							   "count": 2        
					 }, 
					 {         "test": "B", 
							   "count": 1         
					 }
				 ]
			}

			function myobj(){ 
			var obj={ "seed": "QQQ" ,
			   "id" : 1 ,        
			   "n_validation": [2, 3, 4, 5, 6],     
			   "TEXT": [       
					 {            
							   "test": "A",             
							   "count": 2        
					 }, 
					 {         "test": "B", 
							   "count": 1         
					 }
				 ]
			}

          for (var x in obj) {
            if (obj[x] != null &&typeof(obj[x])== 'object') {
			 
			//$("#result").append("key = " + obj.n_validation+"</br>")
			 
			  
			  
			 if(x=="TEXT"){
			  for(var j=0;j<x.length;j++){
			  $("#result").append("成绩 ："+obj.TEXT[j].test+" 数量 ："+obj.TEXT[j].count+"</br>");
			  }
			 }else
			 {
			 
			 for(var i=0;i<obj[x].length;i++){
			   //$("#result").append("成绩 ："+obj.TEXT[i].test+" 数量 ："+obj.TEXT[i].count+"</br>")
			   $("#result").append("Key1 = " + x + " Value = " + obj[x][i]+"</br>")
			   }
			 }
			}
			else{
			  $("#result").append("Key2 = " + x + " Value = " + obj[x]+"</br>"); 
			}
		  }
		}
	</script>
</html>



